package org.myname.struts.example2.action;

import java.util.ArrayList;
import java.util.List;

import org.myname.struts.example2.util.MessageComparator;
import org.mystruts.example1.model.Message;

import com.opensymphony.xwork2.ActionSupport;

public class IteratorTagAction extends ActionSupport {
	
	private List<Message> list;

	public List<Message> getList() {
		return list;
	}

	public void setList(List<Message> list) {
		this.list = list;
	}
	
	public MessageComparator getNameCompare() {
		return new MessageComparator();
	}

	public IteratorTagAction() {
		// TODO Auto-generated constructor stub
		list = new ArrayList<Message>();
		
		Message m1 = new Message();
		m1.setName("name1");
		m1.setMessage("message1");
		list.add(m1);
		Message m2 = new Message();
		m2.setName("name2");
		m2.setMessage("message22222");
		list.add(m2);
		Message m3 = new Message();
		m3.setName("name3");
		m3.setMessage("message3333");
		list.add(m3);
		list.add(m1);
		list.add(m2);
	}

	public String execute() {
		return SUCCESS;
	}
}
